package inner;


import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

class Person{
    public String name = "Tom";
    public int age = 18;

    public void show(){
        System.out.println("姓名:"+name+ " 年龄:"+age);
    }

    //tostring方法重写


//    @Override
//    public String toString() {
//        return "name:" + name + " age:" + age;
//        /*"Person{" +
//                "name='" + name + '\'' +
//                ", age=" + age +
//                '}';*/
//    }

    public String toString(){
       return "khsds";
    }

}



public class Test3 {
    public static void main(String[] args) {
        Person person = new Person();
        System.out.println(person);//打印出“地址”,经过重写后编译器会调用我们重写的方法
    }



}
